package ios.work1;

public class Line extends Point{
    private final Point s1;
    private final Point s2;

    public Line(Point s1,Point s2){
        this.s1=s1;
        this.s2=s2;
    }
    public String getPointX(){
        return "("+s1.getX()+","+s1.getY()+")";
    }
    public double getLine(){
        return Math.sqrt(Math.pow(s1.getX()- s2.getX(),2)+Math.pow(s1.getY()- s2.getY(),2));
    }
    public String getK(){
        if(s1.getX()==s2.getX()){
            return "ERROR";
        }
        return (s2.getY()- s1.getY())/(s2.getX()- s1.getX())+"";
    }
}
